﻿namespace ctolua.Models.Areas
{
    /// <summary>
    /// 多边形区域
    /// </summary>
    public class MPolyArea : MArea
    {
        private PolyArea _polyArea;
        /// <summary>
        /// 多边形区域域实体
        /// </summary>
        public PolyArea polyArea
        {
            get { return this._polyArea; }
            set
            {
                this._polyArea = value;
                this.area = value;
            }
        }
        /// <summary>
        /// 不规则区域内单位数量
        /// </summary>
        /// <returns>单位数量</returns>
        public int? get_unit_num_in_poly_area => game_api.get_unit_num_in_poly_area(this.polyArea);
        /// <summary>
        /// 圆形区域内所有未销毁单位
        /// </summary>
        /// <returns>单位组</returns>
        public UnitGroup get_unit_group_in_poly_area => game_api.get_unit_group_in_poly_area((dynamic)this.polyArea);

        /// <summary>
        /// 不规则区域内所有物品
        /// </summary>
        /// <returns>单位组</returns>
        public ItemGroup get_item_group_in_poly_area => game_api.get_item_group_in_poly_area(this.polyArea);
        /// <summary>
        /// 获取不规则区域顶点列表
        /// </summary>
        /// <returns>顶点列表</returns>
        public decimal get_poly_area_point_list => game_api.get_poly_area_point_list(this.polyArea);

        public MPolyArea(PolyArea polyArea)
        {
            this.polyArea = polyArea;
        }

        /// <summary>
        /// 通过区域ID返回自定义多边形区域
        /// </summary>
        /// <param name="res_id ">  区域ID   </param>
        public MPolyArea(int res_id)
        {
            this.polyArea = game_api.get_polygon_area_by_res_id(res_id);
        }
        /// <summary>
        /// 创建多边形区域(新)
        /// </summary>
        /// <param name="point0 ">  点   </param>
        /// <param name="point1 ">  点   </param>
        /// <param name="point2 ">  点   </param>
        /// <param name="point3 ">  点   None</param>
        /// <param name="point4 ">  点   None</param>
        /// <param name="point5 ">  点   None</param>
        /// <param name="point6 ">  点   None</param>
        /// <param name="point7 ">  点   None</param>
        /// <param name="point8 ">  点   None</param>
        /// <param name="point9 ">  点   None</param>
        /// <param name="point10 ">  点   None</param>
        /// <param name="point11 ">  点   None</param>
        /// <param name="point12 ">  点   None</param>
        public MPolyArea(Point point0, Point point1, Point point2, Point point3 = null, Point point4 = null, Point point5 = null, Point point6 = null, Point point7 = null, Point point8 = null, Point point9 = null, Point point10 = null, Point point11 = null, Point point12 = null)
        {
            this.polyArea = game_api.create_polygon_area_new(point0, point1, point2, point3, point4, point5, point6, point7, point8, point9, point10, point11, point12);
        }

        /// <summary>
        /// 根据tag获取对应的不规则区域
        /// </summary>
        /// <param name="tag ">  tag   </param>
        /// <returns>列表</returns>
        public static dynamic get_polygon_areas_by_tag(string tag) => game_api.get_polygon_areas_by_tag(tag);
        /// <summary>
        /// 点是否在不规则区域内
        /// </summary>
        /// <param name="point ">  点   </param>
        /// <returns>点是否在不规则区域内</returns>
        public bool? judge_point_in_polygon_area(Point point) => game_api.judge_point_in_polygon_area(point, (dynamic)this.polyArea);
        /// <summary>
        /// 设置多边形区域内视野情况
        /// </summary>
        /// <param name="player ">  玩家   </param>
        /// <param name="is_vision ">  布尔变量   </param>
        /// <param name="is_vision_true ">  布尔变量   </param>
        /// <returns>多边形区域</returns>
        public void set_poly_vision_visibility(Role player, bool? is_vision, bool? is_vision_true) => game_api.set_poly_vision_visibility(this.polyArea, player, is_vision, is_vision_true);

    }
}
